package com.spica.platform.threadpool.disruptor.listener;

import com.spica.platform.threadpool.disruptor.AsyncThreadContext;
import com.spica.platform.threadpool.disruptor.event.BaseEvent;
import com.spica.platform.threadpool.disruptor.thread.ExecutorService;
import lombok.Getter;
import lombok.Setter;

/**
 *
 * 模仿java.util.EventListener实现观察者模型
 * 监听event事件，并处理
 */
public abstract class EventListener<E extends BaseEvent,T extends AsyncThreadContext>  {

	@Getter
	@Setter
	private int order;

	@Getter
	@Setter
	protected ExecutorService executorService;
	 
	public abstract  boolean accept(BaseEvent event);
	

	public abstract  void onEvent(E event, T eventContext);
	

}